package com.shanzmoo.open.server.api.web;

import com.shanzmoo.open.server.api.domain.vo.MerchantCallBackVo;
import com.shanzmoo.open.server.api.domain.vo.PayCallBackVo;
import com.shanzmoo.open.server.api.manager.PayCallBackManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author dingmeng
 * @title: PayOpenController
 * @projectName jyf-mall-server
 * @description: 扫呗回调管理
 * @date 2021/4/1614:22
 */
@Slf4j
@Api(tags = "回调管理")
@RestController
@RequestMapping(value ="/open")
@RequiredArgsConstructor
public class OpenController {
    private final PayCallBackManager payCallBackManager;

    @ApiOperation(value = "扫呗预支付回调")
    @PostMapping(value ="/payCallBack")
    public PayCallBackVo payCallBack(HttpServletRequest httpServletRequest) {
        PayCallBackVo vo = payCallBackManager.payCallBack(httpServletRequest);
        return vo;
    }

    @ApiOperation(value = "扫呗商户审核回调")
    @PostMapping("/merchantCallBack")
    public MerchantCallBackVo merchantCallBack(HttpServletRequest httpServletRequest) {
        MerchantCallBackVo vo = payCallBackManager.merchantCallBack(httpServletRequest);
        return vo;
    }
}
